package ${s.pkg};

import la.cplus.common.fsm.ActionNotSupportedException;
import la.cplus.common.fsm.State;
import la.cplus.common.log.LogAble;

public class ${s.name}State extends State implements LogAble {
    private static final long serialVersionUID = 1L;

    /**
     * @param code
     * @param name
     */
    public ${s.name}State(Integer code, String name) {
        super(code, name);
    }
    
    public OrderState(OrderStatus status) {
        super(status.getStatus(), status.getDescription());
    }
    
    protected void entry(${s.name}Context ctx) {
    }

    protected void exit(${s.name}Context ctx) {
    }

    //
#foreach( ${f} in ${s.actions} )
    protected void ${f}(${s.name}Context ctx) {
        handle(ctx);
    }

#end
    //
    void handle(${s.name}Context ctx) {
        log().error("Action is not accpected by Stat[{}:{}]", code, name);
        throw new ActionNotSupportedException();
    }
}
